updating oE trunc
trunc
include math.e namespace math public function trunc(object x)
returns the integer portion of a number.
Parameters:
- value : any Euphoria object.
Returns:
An object, the shape of which depends on values's. Each item in the returned object will be an integer. These are the same corresponding items in value except with any fractional portion removed.
Comments:
- This is essentially done by always rounding towards zero. The floor function rounds towards negative infinity, which means it rounds towards zero for positive values and away from zero for negative values.
- Note that trunc(x) + frac(x) = x
Example 1:
a = trunc(9.4) -- a is 9
Example 2:
s = trunc({81, -3.5, -9.999, 5.5}) -- s is {81,-3, -9, 5}
See Also:
Not Categorized, Please Help
|